<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="16">
        <div class="divLeft">
          <div class="banner">
            <img
              src="~@/assets/home/dashboard-banner-left@2x.5afd2949.png"
              alt=""
              class="img-left"
            >
            <img
              src="~@/assets/home/dashboard-banner-right@2x.28195570.png"
              alt=""
              class="img-right"
            >
            <img
              src="~@/assets/home/avatar@2x.4f4a758f.png"
              alt=""
              class="user-header"
            >
            <p class="user-title">仓储管理员</p>
            <p class="subject-title">我不是为了输赢，我就是认真！</p>
            <p class="subject-author">——罗永浩</p>
            <div class="site">
              <p class="title">北京总仓</p>
            </div>
          </div>
          <div class="backlog">
            <div class="subject">待办信息</div>
            <div>
              <el-row>
                <el-col
                  v-for="(item, index) in TodoList"
                  :key="index"
                  :span="8"
                  style="padding-left: 15px; padding-right: 15px"
                >
                  <router-link to="#">
                    <div class="backlog-item item-list">
                      <div class="icon" :style="`background:${color[index]}`">
                        <i class="el-icon-document" />
                      </div>
                      <div class="title">{{ item.name }}</div>
                      <div class="bottom">
                        <span class="spanlabel">新增</span>
                        <span class="spanValue">{{ item.value1 }}</span>
                        <span class="spanlabel">待审核</span>
                        <span
                          class="spanValue"
                          :style="`color:${color[index]}`"
                        >{{ item.value2 }}</span>
                      </div>
                    </div>
                  </router-link>
                </el-col>
              </el-row>
            </div>
          </div>
        </div>
      </el-col>
      <el-col
        :span="8"
      ><div class="grid-content bg-purple" />
        <div class="notes">
          <div class="subject">通知/公告</div>
          <div v-for="(item, index) in TimeList" :key="index" class="item">
            <div class="hr" />
            <div class="title">{{ item.name }}</div>
            <div class="tiem">{{ item.time }}</div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { Todo } from '@/api/home'
export default {
  data() {
    return {
      TodoList: [],
      color: ['rgb(0, 118, 255', 'rgb(255, 178, 0)', 'rgb(255, 113, 0)'],
      TimeList: [
        {
          name: '紧急盘点通知',
          time: '2020.12.30 18:23:14'
        },
        {
          name: '运维服务更新通知',
          time: '2021.01.25 18:23:14'
        },
        {
          name: '客户入库变更通知',
          time: '2021.01.26 18:23:14'
        },
        {
          name: '五一放假通知',
          time: '2021.02.15 18:23:14'
        },
        {
          name: '品达物流系统对接通知',
          time: '2021.3.25 18:23:14'
        }
      ]
    }
  },
  async created() {
    const { data } = await Todo()
    this.TodoList = data
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.divLeft {
  width: calc(
    100% - 0px
  ); //css3 的 calc()函数。这里的意思是设置宽度比100%的宽度少20px。
  padding-right: 50px;
  .banner {
    position: relative;
    width: 100%;
    height: 148px;
    background: linear-gradient(270deg, #ffc771, #ffa634);
    box-shadow: 0 0 6px 0 rgb(188 151 69 / 12%);
    border-radius: 12px;
  }
  .img-left {
    position: absolute;
    left: 0;
    top: 0;
    height: 148px;
  }
  .img-right {
    position: absolute;
    right: 0;
    top: 0;
    height: 148px;
  }
  .user-header {
    position: absolute;
    top: 31px;
    left: 43px;
    height: 62px;
  }
  .user-title {
    position: absolute;
    left: 36px;
    bottom: 10px;
    font-size: 16px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #332929;
    line-height: 22px;
  }
  .subject-title {
    position: absolute;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #fff;
    line-height: 25px;
    top: 36px;
    left: 200px;
    font-size: 18px;
  }
  .subject-author {
    position: absolute;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #fff;
    line-height: 25px;
    top: 76px;
    left: 400px;
    font-size: 16px;
  }
  .site {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 147px;
    height: 40px;
    background: #f8f5f5;
    border-radius: 6px;
    opacity: 0.79;
    display: flex;
    align-items: center;
    justify-content: center;
    .title {
      font-size: 14px;
      font-weight: 500;
      color: #332929;
    }
  }
  .backlog {
    margin-top: 20px;
    width: 100%;
    height: 282px;
    background: #fff;
    box-shadow: 0 0 6px 0 rgb(144 142 142 / 17%);
    border-radius: 12px;
    padding: 25px;
    .subject {
      font-size: 16px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #332929;
      line-height: 22px;
      margin-bottom: 20px;
    }
  }
  .backlog-item {
    position: relative;
    height: 186px;
    background: #fbf7f7;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    .icon {
      width: 49px;
      height: 49px;
      //   background: #0076ff;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: space-around;
      i {
        font-size: 32px;
        color: #f8f5f5;
      }
    }
    .title {
      position: absolute;
      top: 34px;
      left: 85px;
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #332929;
      line-height: 22px;
    }
    .bottom {
      position: absolute;
      bottom: 20px;
    }
    .spanlabel {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #887e7e;
      margin-right: 10px;
      vertical-align: super;
    }
    .spanValue {
      font-size: 36px;
      font-family: DIN-Medium, DIN;
      font-weight: 500;
      color: #332929;
      margin-right: 10px;
    }
  }
}
.item-list:hover {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  // border: 1px solid #f5efee;
}
.notes {
  width: 261px;
  height: 451px;
  background: #fff;
  box-shadow: 0 0 6px 0 rgb(144 142 142 / 17%);
  border-radius: 12px;
  padding: 30px;
  .subject {
    font-size: 16px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #332929;
    line-height: 22px;
  }
  .item {
    margin-top: 15px;
  }
  .hr {
    width: 201px;
    height: 1px;
    background-color: #f5efee;
  }
  .title {
    width: 195px;
    height: 18px;
    font-size: 13px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #332929;
    line-height: 18px;
    margin-top: 15px;
  }
  .tiem {
    width: 115px;
    height: 17px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #887e7e;
    line-height: 17px;
    margin-top: 10px;
  }
}
</style>
